package gases.as3.librarys.components.ui.special
{
	import gases.as3.librarys.components.ui.GSkinBox;
	import gases.as3.librarys.components.ui.GUIComponents;
	import gases.as3.librarys.components.ui.basic.GLabel;
	
	public class ChooseRoleInfoComponent extends GUIComponents
	{
		public function ChooseRoleInfoComponent()
		{
			super();
		}
		
		override protected function initialization():void
		{
			super.initialization();
			_image = new GSkinBox();
			_roleJob = new GLabel("",0xbda358);
			_roleLevel = new GLabel("",0xbda358);
			_roleName = new GLabel("",0xbda358);
			this.addChild(_image);
			this.addChild(_roleJob);
			this.addChild(_roleLevel);
			this.addChild(_roleName);
			setPostion();
		}
		
		/**
		 *填充图片，可以是bitmap和bitmapdata 
		 * @param value
		 * 
		 */		
		public function drawImage(value:Object):void
		{
			_image.source = value;
			setPostion();
		}
		
		public function setRoleName(value:String):void
		{
			_roleName.text = value;
			setPostion();
		}
		
		public function setRoleLevel(value:String):void
		{
			_roleLevel.text = value;
			setPostion();
		}
		
		public function setRoleJob(value:String):void
		{
			_roleJob.text = value;
			setPostion();
		}
		
		private function setPostion():void
		{
			_roleName.x = _image.Gwidth+3;
			_roleName.y = _image.y;
			_roleJob.x = _roleName.x;
			_roleJob.y = _roleName.Gheight +2;
			_roleLevel.x = _roleJob.x + _roleJob.Gwidth + 3;
			_roleLevel.y = _roleJob.y;
			
		}
		
		override public function dispose():void
		{
			this.removeChild(_image);
			this.removeChild(_roleName);
			this.removeChild(_roleLevel);
			this.removeChild(_roleJob);
			super.dispose();
		}
		
		private var _image:GSkinBox;
		private var _roleName:GLabel;
		private var _roleLevel:GLabel;
		private var _roleJob:GLabel;
	}
}